package main

func main() {

}

type ListNode struct {
	Val  int
	Next *ListNode
}

func mergeInBetween(list1 *ListNode, a int, b int, list2 *ListNode) *ListNode {
	aNode, bNode := new(ListNode), new(ListNode)
	temp1 := list1
	for a > 0 {
		temp1 = temp1.Next
		a--
	}
	aNode = temp1
	temp2 := list1
	for b > 0 {
		temp2 = temp2.Next
		b--
	}
	for list2 != nil {
		aNode.Next = list2
		list2 = list2.Next
		aNode = aNode.Next
	}
	list2 = bNode
	return list1
}
